package com.atguigu.yygh.rabbit.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA
 *
 * @Date: 2023/1/8 - 10:45
 * @Author: Hyoung
 * @Description:
 */
@Service
@Slf4j
public class RabbitService {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public boolean sendMessage(String exchange, String routingKey, Object message) {
        log.info("发送消息.......");
        rabbitTemplate.convertAndSend(exchange, routingKey, message);
        return true;
    }

}
